<template>
  <div class="honor-certificates">
    <h3>荣誉证书</h3>
    <el-form :model="honorForm" label-width="120px">
      <el-form-item label="自定义荣誉名称">
        <el-input v-model="customHonor" placeholder="请输入自定义荣誉名称">
          <template v-slot:append>
            <el-button @click="addCustomHonor">添加</el-button>
          </template>
        </el-input>
      </el-form-item>
    </el-form>
    <div v-for="(honor, index) in customHonors" :key="index" class="custom-honor-item">
      <span>{{ honor.name }}</span>
      <el-button type="text" @click="removeCustomHonor(index)">删除</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      customHonor: '',
      customHonors: []
    };
  },
  methods: {
    addCustomHonor() {
      if (this.customHonor.trim() !== '') {
        this.customHonors.push({ name: this.customHonor });
        this.customHonor = '';
      }
    },
    removeCustomHonor(index) {
      this.customHonors.splice(index, 1);
    }
  }
};
</script>

<style scoped>
.honor-certificates {
  margin-bottom: 20px;
}
.custom-honor-item {
  margin-top: 10px;
}
</style>
